<?php

class VerMarcacionesReporteController extends Controller
{
	/**
	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
	 * using two-column layout. See 'protected/views/layouts/column2.php'.
	 */
	public $layout='//layouts/column2';
		public $defaultAction='admin';
	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
				'rights',
		);
	}

public function actioncreate()
{	

	$model= VerMarcacionesReporte::model()->findAll();
	$content=$this->renderPartial("excel", array("model" =>$model),true );
	yii::app()->request->sendFile("reporte.xls",$content);




}
	/**
	 * Manages all models.
	 */
	public function actionAdmin()
	{
		$model=new VerMarcacionesReporte('search');
		$model->unsetAttributes();  // clear any default values
		if(isset($_GET['VerMarcacionesReporte']))
			$model->attributes=$_GET['VerMarcacionesReporte'];

		$this->render('admin',array(
			'model'=>$model,
		));
	}

	/**
	 * Returns the data model based on the primary key given in the GET variable.
	 * If the data model is not found, an HTTP exception will be raised.
	 * @param integer $id the ID of the model to be loaded
	 * @return VerMarcacionesReporte the loaded model
	 * @throws CHttpException
	 */
	public function loadModel($id)
	{
		$model=VerMarcacionesReporte::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}

	/**
	 * Performs the AJAX validation.
	 * @param VerMarcacionesReporte $model the model to be validated
	 */
	protected function performAjaxValidation($model)
	{
		if(isset($_POST['ajax']) && $_POST['ajax']==='ver-marcaciones-reporte-form')
		{
			echo CActiveForm::validate($model);
			Yii::app()->end();
		}
	}
}
